import { BASE_URL } from './config.js'

//上传文件
export function uploadFiles(path) {
  console.log('sdddd')
  uni.showLoading({
    title: '正在上传'
  })
  console.log(11123, path)

  return new Promise((resolve, reject) => {
    uni.uploadFile({
      url: BASE_URL + '/app-api/infra/file/upload',
      filePath: path,
      name: 'file',
      success: (res) => {
        if (res.statusCode == 200) {
          resolve(JSON.parse(res.data))
        }
      },
      fail: (err) => {
        console.log(err)
      },
      complete(res) {
        uni.hideLoading()
      }
    })
  })
}
